﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Wjtour.Common
{
    public class PaginationData<T>
    {
        private List<T> _list = null;
        public List<T> Datas
        {
            get
            {
                if (_list == null)
                    _list = new List<T>();
                return _list;
            }
            set { _list = value; }
        }
        private PagnationRequest _pager = null;
        public PagnationRequest Pager
        {
            get
            {
                if (_pager == null)
                    _pager = PagnationRequest.GetDefault();
                return _pager;
            }
            set { _pager = value; }
        }

        public string PagnationHtml { get; set; } 
    }

    public class PagnationRequest
    {
        public int CurrentPageIndex { get; set; }
        public int TotalRecords { get; set; }
        public int TotalPages { get; set; }
        public int PageSize { get; set; }

        /// <summary>
        /// 获取默认
        /// </summary>
        /// <returns></returns>
        public static PagnationRequest GetDefault()
        {
            return new PagnationRequest
            {
                CurrentPageIndex = 0,
                TotalRecords = 0,
                TotalPages = 0,
                PageSize = 20
            };
        }
    }
}
